<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
		<title>Combos</title>
		<script type="text/javascript" src="tgd/Math/Combination.js"></script>
		<script type="text/javascript">
			//<![CDATA[

			var _displayDiv
			var _comb = null;
			var _counter = 0;

			function init() {
				var _displayDiv = document.getElementById("combos");
				var set = [];

				for (var i = 0; i < 55; set[i] = ++i);
				_comb = new tgd.Math.Combination(55, 5, set);

				var addCombo = function() {
					var arrG = _comb.element(_counter++);
					var div = document.createElement("div");

					div.innerHTML = (_counter - 1) + ":{" + arrG + "} - " + _comb.getIndex(arrG).toString();
					_displayDiv.insertBefore(div, (_displayDiv.hasChildNodes() ? _displayDiv.childNodes[0] : null));
					if (_displayDiv.hasChildNodes() && _displayDiv.childNodes.length > 90) {  //only keep 10
						_displayDiv.removeChild(_displayDiv.childNodes[90]);
					}

					if (_counter > 0) {
						setTimeout(addCombo, 0);
					} else {
						alert('done?');
					}
				};
				setTimeout(addCombo, 32);
			}

			//]]>
		</script>
		<style type="text/css">
			body,html{margin:0;height:100%;width:100%;background:#333;font-size:.8em;position:relative;}

			#menu{position:fixed;top:0;right:0;font-size:1.5em;border-bottom:solid 1px #ccc;background:#A4C639;color:#666;}
			#combos{background:#fff;font-family:Consolas;padding:.5em;margin:.5em;}
		</style>
	</head>
	<body onload="init();">
		<div id="menu">TODO</div>
		<div id="combos"></div>
	</body>
</html>